<?php

namespace JsonLowCode\UI;

use JsonLowCode\Schema;
use JsonLowCode\Traits\Props\HasType;

/**
 * 行为组件 AppAction
 * @method static AppAction make(mixed $children) AppAction组件
 */
class AppAction extends Button
{
    protected string $componentName = "AppAction";

    /**
     * @param mixed|null $children
     */
    public function __construct(mixed $children)
    {
        parent::__construct();
        $this->eventValue(true);
        $children&&$this->children($children);
    }

    /**
     * 行为类型
     * @param string $type 'click' | 'modal' | 'drawer' | 'api'
     * @return $this
     */
    public function eventType(string $type = 'click' | 'modal' | 'drawer' | 'api'): static
    {
        return $this->prop('event-type', $type);
    }

    /**
     * mitt 键
     * @param string $eventKey
     * @return $this
     */
    public function eventKey(string $eventKey): static
    {
        return $this->prop('event-key', $eventKey);
    }

    /**
     * mitt 值
     * @param mixed $eventValue
     * @return $this
     */
    public function eventValue(mixed $eventValue): static
    {
        return $this->prop('event-value', $eventValue);
    }

}
